/**
 * 
 */
package entity;

import java.util.List;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

/**
 * @author Chigco.Orc
 * 商品类别
 */
@Entity
public class ProductCate {
	public ProductCate() {
	}

	private Long id;
	private String name;
	private ProductCate product;	//父节点
	private List<ProductCate> products; //子节点
//	private int fatId = -1;			//父类id


	@Id
	@GeneratedValue
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@ManyToOne
	@JoinColumn(name = "productId")
	public ProductCate getProduct() {
		return product;
	}
	public void setProduct(ProductCate product) {
		this.product = product;
	}
	@OneToMany(mappedBy = "product")
	public List<ProductCate> getProducts() {
		return products;
	}
	public void setProducts(List<ProductCate> products) {
		this.products = products;
	}
	
//	public int getFatId() {
//		return fatId;
//	}
//	public void setFatId(int fatId) {
//		if(fatId < 0 ) this.fatId = 0;
//		else
//		this.fatId = fatId;
//	}
	
//	@Override
//	public String toString() {
//		return id + "|" + name + "|" +"!" + "||";
//	}
	
}
